from colorama import init, Fore, Back, Style
import time
import datetime
import os

def color_print(func):
    def wrapper(*args, **kwargs):
        init()
        print(Fore.RED + func(*args, **kwargs) + Style.RESET_ALL)

    return wrapper


@color_print
def debug_print(*args, **kwargs) -> str:
    return "[debug] {} {}".format(args, kwargs)


def gen_record_id():
    # generate a unique record id based on date and time
    return datetime.datetime.now().strftime("%Y%m%d%H%M%S") + str(int(time.time()))


def gen_worker_id():
    pid = os.getpid()
    return str(pid) + str(int(time.time()))
